"""
批量重命名目录下的文件
"""
import os


def re_name(path):
    for file in os.listdir(path):
        file_path = os.path.join(path, file)
        print(file_path)
        # 判断这个文件是否是文件夹,是文件夹的话就调用自己,把路径拼接好传过去
        if os.path.isdir(file_path):
            re_name(file_path)
        else:  # 如果不是文件夹,就开始改名字
            file_new = file
            file_new = file_new.replace("阿米娅(近卫)", "amiyajinwei")
            file_new = file_new.replace("陈", "chen")
            file_new = file_new.replace("能天使", "nengtianshi")
            file_new = file_new.replace("非3星结束行动", "fei3xingjieshurenwu")
            file_new = file_new.replace("3星结束行动", "3xingjieshurenwu")
            file_new = file_new.replace("4星结束行动", "4xingjieshurenwu")
            file_new = file_new.replace("编入队伍", "bianruduiwu")
            file_new = file_new.replace("标题", "biaoti")
            file_new = file_new.replace("部署1", "bushu1")
            file_new = file_new.replace("部署2", "bushu2")
            file_new = file_new.replace("戳一下", "chuoyixia")
            file_new = file_new.replace("干员报到", "ganyuanbaodao")
            file_new = file_new.replace("观看作战记录", "guankanzuozhanjilu")
            file_new = file_new.replace("进驻设施", "jinzhusheshi")
            file_new = file_new.replace("晋升后交谈1", "jinshenghoujiaotan1")
            file_new = file_new.replace("晋升后交谈2", "jinshenghoujiaotan2")
            file_new = file_new.replace("精英化晋升1", "jingyinghuajinsheng1")
            file_new = file_new.replace("精英化晋升2", "jingyinghuajinsheng2")
            file_new = file_new.replace("任命队长", "renmingduizhang")
            file_new = file_new.replace("任命助理", "renmingzhuli")
            file_new = file_new.replace("问候", "wenhou")
            file_new = file_new.replace("闲置", "xianzhi")
            file_new = file_new.replace("信赖触摸", "xinlaichumo")
            file_new = file_new.replace("信赖提升后交谈1", "xinlaitishenghoujiaotan1")
            file_new = file_new.replace("信赖提升后交谈2", "xinlaitishenghoujiaotan2")
            file_new = file_new.replace("信赖提升后交谈3", "xinlaitishenghoujiaotan3")
            file_new = file_new.replace("行动出发", "xingdongchufa")
            file_new = file_new.replace("行动开始", "xingdongkaishi")
            file_new = file_new.replace("行动失败", "xingdongshibai")
            file_new = file_new.replace("选中干员1", "xuanzhongganyuan1")
            file_new = file_new.replace("选中干员2", "xuanzhongganyuan2")
            file_new = file_new.replace("作战中1", "zuozhanzhong1")
            file_new = file_new.replace("作战中2", "zuozhanzhong2")
            file_new = file_new.replace("作战中3", "zuozhanzhong3")
            file_new = file_new.replace("作战中4", "zuozhanzhong4")
            file_new = file_new.replace("交谈1", "jiaotan1")
            file_new = file_new.replace("交谈2", "jiaotan2")
            file_new = file_new.replace("交谈3", "jiaotan3")
            file_new_path = os.path.join(path, file_new)
            os.rename(file_path, file_new_path)


if __name__ == '__main__':
    path = r'wav'
    re_name(path)
